package com.sniff.atp.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    private DateUtil() {}

    /**
     * 获取当前的日期
     *
     * @param date new Date
     * @return 2022-11-11
     */
    public static String dateToDay(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(date);
    }


    /**
     * 获取当前的日期
     *
     * @param date new Date
     * @return 2022-11-11 12:00:00
     */
    public static String dateToString(Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(date);
    }

    public static Date date() {
        return new Date();
    }

    public static String longString(){
        long time = new Date().getTime();
        return String.valueOf(time);
    }
}
